<?php
require_once '../include/common.php';
ignore_user_abort();
set_time_limit(0); 
$file = "cache/zt.db";
$hs_num = file_get_contents($file);
$hs= $hs_num + 1;
file_put_contents($file, $hs);

function w_zt($qq,$sid){

	$url='http://ish.z.qq.com/infocenter_v2.jsp?B_UID='.$qq.'&sid='.$sid.'&g_ut=1';
	$result=file_get_contents($url);
	if(strstr($result,'个人中心')){
		return 1;
	}else{
		return 0;
	}
	
}

	$z_sql = "SELECT count(*) FROM `w_qq`";
	$z_sth = $db->query($z_sql);
	$z_num=$z_sth->fetch();
	$z_num = $z_num[0];
	$num=ceil($z_num / $run_num);
	

	$now_num=($hs_num%$num)*$run_num;
	
	$zt_sql = "SELECT `qq`,`sid` FROM `w_qq` limit {$now_num},{$run_num}";
	$zt_sth = $db->query($zt_sql);
	$zt=$zt_sth->fetchAll();
	
	foreach ($zt as $value) {
		$zt=w_zt($value[qq],$value[sid]);
		if(!$zt){
		$sql = "UPDATE `w_qq` SET `zt`='0' WHERE qq='{$value[qq]}'";
		$db->exec($sql);
		}
	}
echo 'ok';